<template>
	<z-paging ref="paging" :refresher-out-rate="0.8" :show-empty-view-reload-when-error="false"
		:empty-view-img-style="{ width: '308rpx', height: '308rpx' }"
		empty-view-error-img="https://oneredhealth.oss-cn-hangzhou.aliyuncs.com/2023/10/12/1c53b8aed0c74201bb092265803a1d48.png"
		empty-view-img="https://oneredhealth.oss-cn-hangzhou.aliyuncs.com/2023/10/12/987eadb1d50949a0a7e25dbbd99abe30.png"
		empty-view-error-text="暂无数据" bg-color="#F9FAFC " v-model="dataList" @query="queryList">
		<view class="products_details">
			<view class="fundList" v-for="(item, index) in dataList">
				<view class="flex_wrap">
					<u-image height="136rpx" width="136rpx"
						:src="item.thumbnail"
						mode="aspectFill" radius="8rpx" />
					<view class="products">
						<text class="products_name">{{item.goodsName}}</text>
							<u-text :text="'市场价：￥'+formatDecimal(
						                                    numDiv(
						                                        item.price,
						                                        100
						                                    )
						                                )" size="28rpx" color="#777" decoration="line-through"
								margin="10rpx 0" />
							<u-text :text="'￥'+formatDecimal(
						                                    numDiv(
						                                        item.channelPriceUnitPrice,
						                                        100
						                                    )
						                                )" size="28rpx" color="#FF7B00" />
						</view>

				</view>
			</view>
		</view>
	</z-paging>
</template>

<script>
	import {
		baseUrl
	} from "@/config/tendIdConfig";
	import {
		numDiv,
	} from "@/js_sdk/nl-precisionNum/precisionNum.js";
	import {
		formatDecimal
	} from "@/utils/index.js";
	export default {
		data() {
			return {
				dataList: [1, 2, 3, 4],
				numDiv, //除
				formatDecimal: formatDecimal,
				isCustomer:false,
				customerId:''
			};
		},
		onLoad(options) {
			this.isCustomer = options.isCustomer
			this.customerId = options.customerId
			console.log(options,'1111')
		},
		methods: {
			queryList(pageNum, pageSize) {
				const token = this.$store.getters?.customer_token || uni.getStorageSync("customer_token")
				const that = this
				if(that.isCustomer){
					uni.request({
						url: baseUrl + "/customer/channel_price/listChannelPriceByCustomerId",
						method: "POST",
						header: {
							Authorization: token
						},
						data: {
							pageNum: pageNum,
							pageSize: pageSize,
							channelPriceCustomerId:that.customerId
						},
						success(res) {
							const dataList = res.data.data.rows ?? []
							that.$refs.paging.complete(dataList)
						}
					})
				}else{
					uni.request({
						url: baseUrl + "/customer/channel_price/listChannelPrice",
						method: "POST",
						header: {
							Authorization: token
						},
						data: {
							pageNum: pageNum,
							pageSize: pageSize,
						},
						success(res) {
							const dataList = res.data.data.rows ?? []
							that.$refs.paging.complete(dataList)
						}
					})
				}
			},
		}
	};
</script>

<style lang="scss" scoped>
	.products_details {
		width: 100%;
		padding: 0 28rpx;
	}

	.fundList {
		background: #FFFFFF;
		border-radius: 16rpx;
		padding: 12rpx;
		margin-top: 28rpx;
	}

	.products {
		margin-left: 18rpx;
	}

	.products_name {
		width: 500rpx;
		display: block;
		color: #3D3D3D;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		-o-text-overflow: ellipsis;
	}
</style>